cmake_minimum_required(VERSION 3.0...3.5)
project(SeriousEngine)

add_definitions(
    -DSEVERSION="0.0.0"
    -DMYDEBUG
    -D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING
)


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_BUILD_TYPE "Debug")
set(YAML_BUILD_SHARED_LIBS OFF)

file(COPY ${CMAKE_SOURCE_DIR}/Res/ DESTINATION ${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}/)

include(${CMAKE_CURRENT_SOURCE_DIR}/3rd/imgui.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/3rd/glad.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/3rd/stbImage.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/3rd/imguizmo.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/3rd/imguiNodeEditor.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/3rd/libigl.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/3rd/eigen.cmake)

set(SDL_TEST OFF)
add_subdirectory(3rd/sdl3)
add_subdirectory(3rd/spdlog)
add_subdirectory(3rd/glm)
set(ASSIMP_BUILD_TESTS OFF)
add_subdirectory(3rd/assimp)
add_subdirectory(3rd/freetype2)
set(YAML_CPP_BUILD_TESTS OFF)
set(YAML_CPP_BUILD_TOOLS OFF)
add_subdirectory(3rd/yaml-cpp)
add_subdirectory(3rd/sol2)
add_subdirectory(3rd/lua-5.3.5)
set(BUILD_EXTRAS OFF)
set(BUILD_CPU_DEMOS OFF)
set(BUILD_BULLET2_DEMOS OFF)
set(BUILD_SHARED_LIBS OFF)
set(BUILD_UNIT_TESTS OFF)
add_subdirectory(3rd/bullet)


add_subdirectory(src/SECore)
add_subdirectory(src/SEEdit)
add_subdirectory(src/SEWindow)
add_subdirectory(src/SEUi)
add_subdirectory(src/SEDebug)
add_subdirectory(src/SERender)
add_subdirectory(src/SEPhysics)
add_subdirectory(src/SEngine)
add_subdirectory(src/SEMath)
# add_subdirectory(src/SEGamePlay)
add_subdirectory(src/SEAnimation)
add_subdirectory(src/SESerializeYAML)
add_subdirectory(src/SEAssets)
add_subdirectory(src/SEJsonConfig)

add_subdirectory(src/SEForwardRenderPiplinePlugin)
add_subdirectory(src/SEDRPPlugin)
add_subdirectory(src/SERayTracePlugin)

add_subdirectory(test)

set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install)
install(
    TARGETS SEEdit SECore SEWindow SEUi SEDebug SERender 
            SEPhysics SEngine SEMath SEAnimation SESerializeYAML 
            SEAssets SEJsonConfig SEForwardRenderPiplinePlugin SEDRPPlugin SERayTracePlugin SDL2
    RUNTIME DESTINATION bin
)
install(
    DIRECTORY ${CMAKE_SOURCE_DIR}/Res/
    DESTINATION bin
)
